{% extends "rest/base.html" %}
{% load i18n %}

{% block body %}
<div class="resource" style="width=100%;">

<table class="resource_methods" border="0" style="width:50%;">
    <caption> {% trans "Valid Methods" %} </caption>
    {% for method in resource.permitted_methods %}
    <tr> 
	    <td> {{ method }} </td>
    </tr>
    {% endfor %}
</table>

<br/>
{% if resource.responder %}
<table class="resource_responder" border="0" style="width:50%;">
    <caption> {% trans "Responder" %} </caption>
    <tr><td> {{ resource.responder }} </td></tr>
</table>
{% else %}
    {% trans "No responder" %}
{% endif %}

<br/>
{% if fields %}
    <table class="resource_responder_fields" border="0" style="width:50%;">
      <caption> {% trans "Exposed Fields" %} </caption>
      <tr>
    	    <td>{% trans "Field Name" %}</td>
    	    <td>{% trans "Attribute"%}</td>
          <td>{% trans "Value"%}</td>
      </tr>
	{% for field in fields %}
      <tr>
          <td> <b>{{ field.name }} </b> </td>
      </tr>
      <tr>
          <td></td>
          <td> {% trans "Type" %}</td>
          <td> {{ field.description }} </td>
      </tr>
      <tr>
          <td></td>
          <td> {% trans "Required"%}
          <td> {{ field.blank }} </td>
      </tr>
      <tr>
          <td></td>
          <td> {% trans "Editable" %}</td>
          <td> {{ field.editable }} </td>
      </tr>

      {% if field.max_length %}
      <tr>
        <td></td>
        <td>{% trans "Max Length"%}</td>
        <td>{{ field.max_length}}
      </tr>
      {% endif %}
      
      {% if field.choices %}
      <tr>
          <td></td>
          <td>{% trans "Choices" %}</td>
          <td>{{ field.choices }}</td>
      </tr>
      {% endif %}
      
      {% if field.help_text %}
      <tr>
          <td>{% trans "Help Text"%}</td>
          <td> {{ field.help_text }} </td>
      </tr>
      {% endif %}
      
	{% endfor %}
    </table>
{% else %}
    {% trans "Not exposing fields" %}
{% endif %}


</div>
{% endblock %}
